/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import { defineComponent, getCurrentInstance, toRefs, withKeys } from 'vue'
import { useLogin } from './use-login'
import {UserInfoRes} from "@/service/modules/users/types";
import router from "@/router";
import { useUserStore } from '@/store/user/user'
import {SystemHandleObject} from "@/utils/SystemHandleObject";

/**
 * 自动登录页面 lmy 2024-05-17
 */
const AutoLogin = defineComponent({
  name: 'AutoLogin',
  setup() {
    const userStore = useUserStore()
    const { handleLogin } =  useLogin({
      // loginForm:{userName:'admin',userPassword:'dolphinscheduler123'},
      loginForm:{userName:'hadoop',userPassword:'jiuzhou_6001'},
      changeRouter:false,
      loginFormRef:{
        validate:function (callBack:any){
          callBack(false);
        }
      }
    })
    if(!((userStore.getUserInfo as UserInfoRes).userName)){
      handleLogin();
      SystemHandleObject.setToPretendCookie("userInfoObj",(userStore.getUserInfo as UserInfoRes));
    }
    router.push({ path: SystemHandleObject.getOuterPath()+'' })
    // router.push({ path: '/home' })
    // router.push({ path: '/projects/list' })
    // router.push({ path: '/resource/file-manage' })
    // router.push({ path: '/data-quality/task-result' })
    // router.push({ path: '/datasource' })
    // router.push({ path: '/monitor/master' })
    // router.push({ path: '/security/tenant-manage' })
    return {

    }
  },
  render() {
    return (
      <div >

      </div>
    )
  }
})

export default AutoLogin
